﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Interactivity;
using System.Windows.Controls;
using System.Windows;

namespace WpfWordsLearner
{
	public class MouseLeftBDownAction : TriggerAction<DataGrid>
	{
		protected override void OnAttached()
		{
			base.OnAttached();

			// Insert code that you want to run when the Trigger is attached to an object.
		}

		protected override void OnDetaching()
		{
			base.OnDetaching();
			// Insert code that you would want run when the Trigger is removed from an object.
		}

		protected override void Invoke(object parameter)
		{
			if (AssociatedObject.DataContext == null)
				return;

			(AssociatedObject.DataContext as ViewModels.Windows1ViewModel).StartPoint = (parameter as System.Windows.Input.MouseButtonEventArgs).GetPosition(null);
		}
	}
}
